class Solution {//leetcode78——子集
private:
    void _dfs(const vector<int>& nums,int pos){
        ret.push_back(path);
        if(pos==nums.size()) return;
        for(int i=pos;i<nums.size();i++){
            path.push_back(nums[i]);
            _dfs(nums,i+1);
            path.pop_back();//恢复现场
        }
    }
public:
    vector<vector<int>> subsets(vector<int>& nums) {
        _dfs(nums,0);
        return ret;
    }
private:
    vector<vector<int>> ret;
    vector<int> path;
};